// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
 
  const db = cloud.database()
  return {
    
    daifukuan: await db.collection('orders').where({ status:0}).count(),
    daifahuo: await db.collection('orders').where({status:1}).count(),
    yisonghuo: await db.collection('orders').where({status:2}).count(),
    daishouli: await db.collection('orders').where({ refundStatus:0}).count(),
    daishouhuo: await db.collection('orders').where({ refundStatus:1}).count(),
    daidakuan: await db.collection('orders').where({ refundStatus:2}).count(),
  }
}